package com.library.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.library.common.base.ApiResult;
import com.library.common.entity.MyPage;
import com.library.service.appInterfaceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequiredArgsConstructor
@RequestMapping("wxApi/appInterface")
@Api(tags = "首页分类查询资源", value = "首页分类查询资源接口")
public class appInterfaceController {

    @Resource
    private appInterfaceService service;

    /**
     * 首页分类查询资源
     *
     * @return
     */
    @ApiOperation(value = "首页分类查询资源")
    @GetMapping("/getProductResources")
    public ApiResult getProductResources() {
        return service.getProductResources();
    }


    @GetMapping("/getTypeResources/{id}")
    public ApiResult getTypeResources(@PathVariable("id" ) Long id) {
        return service.getTypeResources(id);
    }

    @GetMapping("/getResources")
    public ApiResult getResources(Page page, Long id) {
        return service.getResources(id,page);
    }

    @GetMapping("/downloadAndParseEpub")
    public ResponseEntity<String> downloadAndParseEpub(String url) {
        return service.downloadAndParseEpub1(url);
    }

}
